#!/bin/zsh

apt-get install procps -y
# 查找并杀死调度器进程
SCHEDULER_PID=$(pgrep -f "@modelcontextprotocol/inspector")
if [ -n "$SCHEDULER_PID" ]; then
    echo "Stopping Mcp Server (PID: $SCHEDULER_PID)"
    kill $SCHEDULER_PID
fi

# 等待几秒确保完全停止
sleep 5

# 启动MCP 服务
echo "Starting MCP Server"

export INSPECTOR_HOST=0.0.0.0
nohup npx @modelcontextprotocol/inspector uv run main.py > mcp_server.log 2>&1 &